package h.a.a.g;

import android.os.Handler.Callback;
import android.os.Message;
import c.j.a.c.y.a.i;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;

/* compiled from: AsyncOperationExecutor */
public class b implements Runnable, Callback {
    public static ExecutorService e = Executors.newCachedThreadPool();
    public final BlockingQueue<a> a = new LinkedBlockingQueue();
    public volatile int b = 50;
    public volatile int c = 50;
    public int d;

    public final void a(a aVar) {
        System.currentTimeMillis();
        try {
            throw null;
        } catch (Throwable th) {
            aVar.a = th;
            System.currentTimeMillis();
            b(aVar);
        }
    }

    public final void b(a aVar) {
        synchronized (aVar) {
            aVar.notifyAll();
        }
        synchronized (this) {
            int i = this.d + 1;
            this.d = i;
            if (i == 0) {
                notifyAll();
            }
        }
    }

    public boolean handleMessage(Message message) {
        return false;
    }

    public void run() {
        while (true) {
            try {
                a aVar = (a) this.a.poll(1, TimeUnit.SECONDS);
                if (aVar == null) {
                    synchronized (this) {
                        aVar = (a) this.a.poll();
                        if (aVar == null) {
                            return;
                        }
                    }
                }
                a(aVar);
            } catch (InterruptedException e) {
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.append(Thread.currentThread().getName());
                stringBuilder.append(" was interruppted");
                i.H(stringBuilder.toString(), e);
                return;
            }
        }
    }
}
